import os
import torch
import numpy as np


# 主路径
MAIN_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SRC_PATH = os.path.join(MAIN_PATH, 'src')

# 数据存储路径
DATA_PATH = r'F:\DataCenter\DataCollections\NLP\jd_nlp_clothing' # 本地
# DATA_PATH = r'/home/user10000630/notespace/raw_data' # JD平台
PROCESSED_DATA_PATH = os.path.join(MAIN_PATH, 'processed_data')

# 模型保存路径
SAVED_MODEL_PATH = os.path.join(MAIN_PATH, 'saved_models')
# SAVED_GENSIM_PATH = os.path.join(SAVED_MODEL_PATH, 'gensim')
# SAVED_TORCH_PATH = os.path.join(SAVED_MODEL_PATH, 'torch')

# 词典上限
MAX_VOCAB_SIZE = 30000

# 句子长度上线
INPUT_MAX_LEN = 100
TARGET_MAX_LEN = 50

# 模型设置
MODEL_CONF = {
    'model_name': 'cb_model',
    'save_dir': SAVED_MODEL_PATH,
    'attn_model': 'general',
    'hidden_size': 500,
    'encoder_num_layers': 2,
    'decoder_num_layers': 2,
    'dropout': 0.5,
    'batch_size': 32,
    'bidirectional': False,
    'attn_method': 'general',
    'save_model_path': None,
    'pointer': True,
    'is_coverage': False,
    'coverage_loss_weight': 0.01,
    'weight_tying': False,
}

# 模型保存路径
SAVED_TORCH_ATTN_PATH = os.path.join(SAVED_MODEL_PATH, 'torch/attn')
SAVED_TORCH_PTN_PATH = os.path.join(SAVED_MODEL_PATH, 'torch/ptn')
SAVED_TORCH_COV_PATH = os.path.join(SAVED_MODEL_PATH, 'torch/cov')

if MODEL_CONF['pointer'] == False:
    MODEL_CONF['save_model_path'] = SAVED_TORCH_ATTN_PATH
elif MODEL_CONF['pointer'] == True and MODEL_CONF['is_coverage'] == False:
    MODEL_CONF['save_model_path'] = SAVED_TORCH_PTN_PATH
elif MODEL_CONF['pointer'] == True and MODEL_CONF['is_coverage'] == True:
    MODEL_CONF['save_model_path'] = SAVED_TORCH_COV_PATH

# 极小的数字
epsilon = 1e-12

# GPU还是CPU
DEVICE = torch.device('cuda' if torch.cuda.is_available() else 'cpu')

# 空值类型
NULLS = {
    'str': '',
    'int': 0,
    'float': 0.0
}